<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	<head>
		<title>Container Events</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="featured" content="yes"><meta name="title" content="Samples" />
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<link rel="icon" href="../common/favicon.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="../common/favicon.ico" type="image/x-icon" />
		<link rel="stylesheet" href="../common/css/style.css" type="text/css" media="screen" />

	</head>
	<body onload="doOnLoad();">
        <div class="header">
            <a class="logo" href="http://www.dhtmlx.com" title="DHTMLX homepage"></a>
            <div class="tittle-dhtmlx">DHTMLX Docs & Samples Explorer</div>
            <div class="search-field">
                <form action="http://docs.dhtmlx.com/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><input class="button" type="submit" value=""><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>
            </div>
            <div class="buttons">
                <a class="doc_inact" href="../../../docsExplorer/index.html" title="DHTMLX Documentation homepage"></a>
                <a class="sample"></a>
            </div>
        </div>
        <div class="content">
            <div class="navigation-div">
                <a href="../../../docsExplorer/samples.html" class="navigation"><img src="../common/icons/file.gif" alt="" >All components</a>
                <div class="arrow"></div>
                <a href="../index.html" class="navigation"><img height="22" src="../common/icons/form.gif" alt="" >dhtmlxForm</a>
                <div class="arrow"></div>
                <a href="./index.html" class="navigation"><img src="../common/icons/none.gif" alt="" >Events</a>
            </div>
            <div style="display:block;">
                <h3>Container Events</h3>
            </div>
            <div class="navigation-div">
                <a href="#code" class="navigation view-source"><img src="../common/icons/source.gif" alt="" >View page source</a>
            </div>
            <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxform_dhx_skyblue.css">
	<link rel="stylesheet" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
	<link rel="stylesheet" type="text/css" href="../../../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
	<script src="../../codebase/dhtmlxcommon.js"></script>
	<script src="../../codebase/dhtmlxform.js"></script>
	<script src="../../codebase/ext/dhtmlxform_item_container.js"></script>
	<script src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
	<script src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<style>
		/* some custom style to make grid pretty in disabled state */
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue {
			border: 1px solid #c2d0dd !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue .ftr,
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue .xhdr {
			background-image: none !important;
			background-color: #fafafa !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.hdr tr {
			background-image: none !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.hdr td {
			border-right: 1px solid #c2d0dd !important;
			border-bottom: 1px solid #c2d0dd !important;
			color: #b2b2b2 !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue .odd_dhx_skyblue {
			background-color: #fafafa !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj.row20px tr td {
			color: #b2b2b2 !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.rowselected,
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj.row20px tr.rowselected td,
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.rowselected td.cellselected {
			background-image: none !important;
			background-color: white !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.odd_dhx_skyblue.rowselected,
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj.row20px tr.odd_dhx_skyblue.rowselected td,
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.odd_dhx_skyblue.rowselected td.cellselected {
			background-image: none !important;
			background-color: #fafafa !important;
		}
		.dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr td span {
			color: #b2b2b2 !important;
		}
		/* grid styled ended */
		
		/* log */
		div#simpleLog {
			width: 500px;
			height: 200px;
			font-family: Tahoma;
			font-size: 11px;
			overflow: auto;
		}
	</style>
	<script>
		var myForm, formData, grid, logObj;
		
		function doOnLoad() {
			formData = [
				{type: "settings", labelWidth: 130, inputWidth: 170},
				{type: "checkbox", label: "Enable / Disable", checked: true, position: "label-right", list: [
					{type: "input", label: "Full Name", value: "Kaapori Lumikaastra"},
					{type: "input", label: "Email", value: "kaapori.lumi@gmail.com"},
					{type: "container", name: "myGrid", label: "Select Product", inputWidth: 330, inputHeight: 200}
				]}
			];
			myForm = new dhtmlXForm("myForm", formData);
			
			grid = new dhtmlXGridObject(myForm.getContainer("myGrid"));
			grid.setSkin("dhx_skyblue");
			grid.setImagePath("../../../dhtmlxGrid/codebase/imgs/");
			grid.loadXML("../common/grid.xml?etc="+new Date().getTime());
			
			// events
			
			// do now allow edit if grid disabled
			grid.attachEvent("onEditCell", function(state){
				// _isItemEnabled return true/false of enable/disable state, which is controlled by script
				// when isItemEnabled (w/o "_") - state controlled by user
				// wi need script-state here to check parent checkbox
				if (!myForm._isItemEnabled("myGrid")) return false;
				return true;
			});
			
			grid.attachEvent("onBeforeSelect", function(){
				if (!myForm._isItemEnabled("myGrid")) return false;
				return true;
			})
			
			// form events
			myForm.attachEvent("onEnable", function(name){
				if (name == "myGrid") changeState("enabled");
			});
			myForm.attachEvent("onDisable", function(name){
				if (name == "myGrid") changeState("disabled");
			});
			
		}
		
		// change grid state
		function changeState(state) {
			logEvent("grid's state changed to: "+state+"</br>");
		}
		
		// logs
		function logEvent(t) {
			if (!logObj) logObj = document.getElementById("simpleLog");
			logObj.innerHTML += t;
			logObj.scrollTop = logObj.scrollHeight;
		}
		function clearLog() {
			if (!logObj) logObj = document.getElementById("simpleLog");
			logObj.innerHTML = "";
		}
		
	</script>


	<table>
		<tr><td><div id="myForm"></div></td></tr>
		<tr><td style='padding-top: 20px;'><b>Log (<a href="javascript:void(0);" onclick="clearLog();">clear</a>)</b></td></tr>
		<tr><td><div id="simpleLog"></div></td></tr>
	</table>
			
			
         </div>
    <div style="clear:both;"></div>
    <div class="source">
        <div class="teg">Source</div>
        <div class="code" id="code">
		<div class="hl-main"><pre><span class="hl-brackets">&lt;</span><span class="hl-reserved">link</span><span class="hl-code"> </span><span class="hl-var">rel</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">stylesheet</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/css</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">href</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/skins/dhtmlxform_dhx_skyblue.css</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">link</span><span class="hl-code"> </span><span class="hl-var">rel</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">stylesheet</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/css</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">href</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../../dhtmlxGrid/codebase/dhtmlxgrid.css</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">link</span><span class="hl-code"> </span><span class="hl-var">rel</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">stylesheet</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/css</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">href</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/dhtmlxcommon.js</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/dhtmlxform.js</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/ext/dhtmlxform_item_container.js</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../../dhtmlxGrid/codebase/dhtmlxgrid.js</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../../dhtmlxGrid/codebase/dhtmlxgridcell.js</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">style</span><span class="hl-brackets">&gt;</span><span class="hl-code">
        /* some custom style to make grid pretty in disabled state */
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue {
            border: 1px solid #c2d0dd !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue .ftr,
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue .xhdr {
            background-image: none !important;
            background-color: #fafafa !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.hdr tr {
            background-image: none !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.hdr td {
            border-right: 1px solid #c2d0dd !important;
            border-bottom: 1px solid #c2d0dd !important;
            color: #b2b2b2 !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue .odd_dhx_skyblue {
            background-color: #fafafa !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj.row20px tr td {
            color: #b2b2b2 !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.rowselected,
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj.row20px tr.rowselected td,
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.rowselected td.cellselected {
            background-image: none !important;
            background-color: white !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.odd_dhx_skyblue.rowselected,
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj.row20px tr.odd_dhx_skyblue.rowselected td,
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr.odd_dhx_skyblue.rowselected td.cellselected {
            background-image: none !important;
            background-color: #fafafa !important;
        }
        .dhxform_obj_dhx_skyblue div.disabled div.gridbox_dhx_skyblue table.obj tr td span {
            color: #b2b2b2 !important;
        }
        /* grid styled ended */
        
        /* log */
        div#simpleLog {
            width: 500px;
            height: 200px;
            font-family: Tahoma;
            font-size: 11px;
            overflow: auto;
        }
    </span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">style</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"><div class="hl-main"><pre><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">myForm</span><span class="hl-code">,
</span><span class="hl-identifier">formData</span><span class="hl-code">,
</span><span class="hl-identifier">grid</span><span class="hl-code">,
</span><span class="hl-identifier">logObj</span><span class="hl-code">;
 
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">doOnLoad</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-identifier">formData</span><span class="hl-code"> = </span><span class="hl-brackets">[</span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-identifier">type</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">settings</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
        </span><span class="hl-identifier">labelWidth</span><span class="hl-code">: </span><span class="hl-number">130</span><span class="hl-code">,
        </span><span class="hl-identifier">inputWidth</span><span class="hl-code">: </span><span class="hl-number">170</span><span class="hl-code">
    </span><span class="hl-brackets">}</span><span class="hl-code">, </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-identifier">type</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">checkbox</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
        </span><span class="hl-reserved">label</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Enable / Disable</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
        </span><span class="hl-identifier">checked</span><span class="hl-code">: </span><span class="hl-reserved">true</span><span class="hl-code">,
        </span><span class="hl-identifier">position</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">label-right</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
        </span><span class="hl-identifier">list</span><span class="hl-code">: </span><span class="hl-brackets">[</span><span class="hl-brackets">{</span><span class="hl-code">
            </span><span class="hl-identifier">type</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">input</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-reserved">label</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Full Name</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-identifier">value</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Kaapori Lumikaastra</span><span class="hl-quotes">&quot;</span><span class="hl-code">
        </span><span class="hl-brackets">}</span><span class="hl-code">, </span><span class="hl-brackets">{</span><span class="hl-code">
            </span><span class="hl-identifier">type</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">input</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-reserved">label</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Email</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-identifier">value</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">kaapori.lumi@gmail.com</span><span class="hl-quotes">&quot;</span><span class="hl-code">
        </span><span class="hl-brackets">}</span><span class="hl-code">, </span><span class="hl-brackets">{</span><span class="hl-code">
            </span><span class="hl-identifier">type</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">container</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-identifier">name</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">myGrid</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-reserved">label</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Select Product</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
            </span><span class="hl-identifier">inputWidth</span><span class="hl-code">: </span><span class="hl-number">330</span><span class="hl-code">,
            </span><span class="hl-identifier">inputHeight</span><span class="hl-code">: </span><span class="hl-number">200</span><span class="hl-code">
        </span><span class="hl-brackets">}</span><span class="hl-brackets">]</span><span class="hl-code">
        </span><span class="hl-brackets">}</span><span class="hl-brackets">]</span><span class="hl-code">;
    </span><span class="hl-identifier">myForm</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXForm</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">myForm</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">formData</span><span class="hl-brackets">)</span><span class="hl-code">;
 
    </span><span class="hl-identifier">grid</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXGridObject</span><span class="hl-brackets">(</span><span class="hl-identifier">myForm</span><span class="hl-code">.</span><span class="hl-identifier">getContainer</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">myGrid</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">grid</span><span class="hl-code">.</span><span class="hl-identifier">setSkin</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">dhx_skyblue</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">grid</span><span class="hl-code">.</span><span class="hl-identifier">setImagePath</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../../dhtmlxGrid/codebase/imgs/</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">grid</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">../common/grid.xml?etc=</span><span class="hl-quotes">&quot;</span><span class="hl-code"> + </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-builtin">Date</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">getTime</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
 
    </span><span class="hl-comment">//</span><span class="hl-comment"> events</span><span class="hl-comment"></span><span class="hl-code">
    </span><span class="hl-comment">//</span><span class="hl-comment"> do now allow edit if grid disabled</span><span class="hl-comment"></span><span class="hl-code">
    </span><span class="hl-identifier">grid</span><span class="hl-code">.</span><span class="hl-identifier">attachEvent</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">onEditCell</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-identifier">state</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-comment">//</span><span class="hl-comment"> _isItemEnabled return true/false of enable/disable state, which is controlled by script</span><span class="hl-comment"></span><span class="hl-code">
        </span><span class="hl-comment">//</span><span class="hl-comment"> when isItemEnabled (w/o &quot;_&quot;) - state controlled by user</span><span class="hl-comment"></span><span class="hl-code">
        </span><span class="hl-comment">//</span><span class="hl-comment"> wi need script-state here to check parent checkbox</span><span class="hl-comment"></span><span class="hl-code">
        </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code">!</span><span class="hl-identifier">myForm</span><span class="hl-code">.</span><span class="hl-identifier">_isItemEnabled</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">myGrid</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">
            </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">false</span><span class="hl-code">;
        </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">true</span><span class="hl-code">;
    </span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">;
 
    </span><span class="hl-identifier">grid</span><span class="hl-code">.</span><span class="hl-identifier">attachEvent</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">onBeforeSelect</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code">!</span><span class="hl-identifier">myForm</span><span class="hl-code">.</span><span class="hl-identifier">_isItemEnabled</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">myGrid</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">
            </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">false</span><span class="hl-code">;
        </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">true</span><span class="hl-code">;
    </span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">
 
    </span><span class="hl-comment">//</span><span class="hl-comment"> form events</span><span class="hl-comment"></span><span class="hl-code">
    </span><span class="hl-identifier">myForm</span><span class="hl-code">.</span><span class="hl-identifier">attachEvent</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">onEnable</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-identifier">name</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">name</span><span class="hl-code"> == </span><span class="hl-quotes">&quot;</span><span class="hl-string">myGrid</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">
            </span><span class="hl-identifier">changeState</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">enabled</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">myForm</span><span class="hl-code">.</span><span class="hl-identifier">attachEvent</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">onDisable</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-identifier">name</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">name</span><span class="hl-code"> == </span><span class="hl-quotes">&quot;</span><span class="hl-string">myGrid</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">
            </span><span class="hl-identifier">changeState</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">disabled</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">;
 
</span><span class="hl-brackets">}</span><span class="hl-code">
 
</span><span class="hl-comment">//</span><span class="hl-comment"> change grid state</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">changeState</span><span class="hl-brackets">(</span><span class="hl-identifier">state</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-identifier">logEvent</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">grid's state changed to: </span><span class="hl-quotes">&quot;</span><span class="hl-code"> + </span><span class="hl-identifier">state</span><span class="hl-code"> + </span><span class="hl-quotes">&quot;</span><span class="hl-string">&lt;/br&gt;</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
 
</span><span class="hl-comment">//</span><span class="hl-comment"> logs</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">logEvent</span><span class="hl-brackets">(</span><span class="hl-identifier">t</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code">!</span><span class="hl-identifier">logObj</span><span class="hl-brackets">)</span><span class="hl-code">
        </span><span class="hl-identifier">logObj</span><span class="hl-code"> = </span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">simpleLog</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">logObj</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> += </span><span class="hl-identifier">t</span><span class="hl-code">;
    </span><span class="hl-identifier">logObj</span><span class="hl-code">.</span><span class="hl-identifier">scrollTop</span><span class="hl-code"> = </span><span class="hl-identifier">logObj</span><span class="hl-code">.</span><span class="hl-identifier">scrollHeight</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">clearLog</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code">!</span><span class="hl-identifier">logObj</span><span class="hl-brackets">)</span><span class="hl-code">
        </span><span class="hl-identifier">logObj</span><span class="hl-code"> = </span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">simpleLog</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">logObj</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-quotes">&quot;</span><span class="hl-quotes">&quot;</span><span class="hl-code">;
</span><span class="hl-brackets">}</span></pre></div></span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
 
 
    </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">table</span><span class="hl-brackets">&gt;</span><span class="hl-code">
        </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">tr</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">td</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">myForm</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">td</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">tr</span><span class="hl-brackets">&gt;</span><span class="hl-code">
        </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">tr</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">td</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">='</span><span class="hl-var">padding-top:</span><span class="hl-code"> </span><span class="hl-var">20px</span><span class="hl-code">;'</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">b</span><span class="hl-brackets">&gt;</span><span class="hl-code">Log (</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">a</span><span class="hl-code"> </span><span class="hl-var">href</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">javascript:void(0);</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">clearLog();</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">clear</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">a</span><span class="hl-brackets">&gt;</span><span class="hl-code">)</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">b</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">td</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">tr</span><span class="hl-brackets">&gt;</span><span class="hl-code">
        </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">tr</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">td</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">simpleLog</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">td</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">tr</span><span class="hl-brackets">&gt;</span><span class="hl-code">
    </span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">table</span><span class="hl-brackets">&gt;</span></pre></div>
        </div>
    <div class="footer">
        <div class="footer-logo"></div>
        <div class="copyright">Copyright &copy; 1998-2012 DHTMLX LTD.<br />All rights reserved.</div>
    </div>
	</body>
</html>